﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMeterParamFrame.Model.DIValueConverters
{
    class Converter_MeterNumber : IDIDataConverter
    {
        public bool CanConverter(string di)
        {
            return di.Equals("04000402");
        }

        public string ConvertToUI(string di, string value)
        {
            int firtPositiveIndex = value.IndexOfAny(DIValueConverter.NUMBER_POSITIVE);
            string newValue = value.Substring(firtPositiveIndex, value.Length - firtPositiveIndex);
            return newValue;
        }

        public string ConvertToLow(string di, string value)
        {
            string newValue = value.PadLeft(12, '0');
            return newValue;
        }

        public bool ValidateValue(string di, string value)
        {
            throw new NotImplementedException();
        }
    }
}
